package com.uphone.kingmall.adapter;

import android.widget.ImageView;

import com.blankj.utilcode.util.SizeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.china.zhuoyue.R;
import com.uphone.kingmall.bean.CircleIndexShopBean;
import com.uphone.kingmall.utils.GlideUtils;
import com.uphone.kingmall.utils.RatingBar;

/**
 * author : SuMeng
 * e-mail : 986335838@qq.com
 * time   : 2019/02/18
 * desc   : 商圈共用adpater
 */
public class CircleAdpater extends BaseQuickAdapter<CircleIndexShopBean.DataBean.ShopsBean, BaseViewHolder> {

    public CircleAdpater() {
        super(R.layout.kingmall_item_circle);
    }

    @Override
    protected void convert(final BaseViewHolder helper, final CircleIndexShopBean.DataBean.ShopsBean item) {
        helper.setText(R.id.tv_shop_name, "" + item.getShopName());
        helper.setText(R.id.tv_desc, "" + item.getShopDesc());
        if (item.getJuli() != null) {
            if (item.getJuli() > 100) {
                helper.setText(R.id.tv_right, (item.getJuli() / 1000) + "km");
            } else {
                helper.setText(R.id.tv_right, "" + item.getJuli() + "m");
            }
        }
        RatingBar rbShop = helper.getView(R.id.rb_shop);
        rbShop.setStar(item.getShopScore());
        ImageView iv_lawyer_icon = helper.getView(R.id.iv_shop);
        GlideUtils.getInstance().loadCornerImage(mContext,item.getShopHeadImg(), SizeUtils.dp2px(4),iv_lawyer_icon);
    }
}